﻿using Ninject;
using Ninject.Modules;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LiteStep.Utils
{
	public class Ninjector
	{
		private StandardKernel injector;

		private StandardKernel Injector
		{
			get
			{
				return injector ?? initialize();
			}
		}

		public T Get<T>()
		{
			return Injector.Get<T>();
		}

		public void Initialize(NinjectModule module)
		{
			injector = new StandardKernel();

			if (module != null)
				injector.Load(module);
		}

		private StandardKernel initialize()
		{
			this.Initialize(new DefaultNinjectModule());
			return injector;
		}
	}
}
